<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>请假页面</title>
		<link rel="stylesheet" type="text/css" href="css/qingjia.css">
		<script type="text/javascript" src="js/vue.js"></script>
		<script type="text/javascript" src="js/jquery-1.4.1.js"></script>
		<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
		<style type="text/css">
			
			/* #main {
				font-family: 微软雅黑;
				font-size: 15px;
				text-align: center;
				height: 40px;
				vertical-align: middle;
				line-height: 40px;
				margin: 150px 500px;
			} */
		
			.float-left {
				float: left;
			}
			.anniu {
				float: left;
				margin-top: 25px;
				margin-left: 15px;
			}
		
			.roleData {
				margin-left: -75px;
			}
		
			.check {
				margin-right: 30px;
			}
			#tianjia{
				margin-right: 350px;
			}
			.hhh{
				width: 100px;
				margin-left: 20px;
			}
			.hang{
				margin-top: 5px;
			}
		</style>
	</head>
	<body>
		
		<div id="container">
			<div id="menu">
				
				<div class="menu-level-0">请假申请</div>
				<div class="menu-level-1"><a href="banji.html">班级新增</a></div>
			</div>
			
			<div id="qingjia">
				
				<div id="qingjia-left">
					<!-- qingjia-left -->
				</div>
				<div id="qingjia-right">
					<!-- qingjia-right -->
					<div id="add-name">
						<input type="text" v-model="roleName"/>
					</div>
					<div id="add-desc">
						<input type="text" v-model="roleName"/>
					</div>
				</div>
				
			</div>
		</div>
	</body>
	<script type="text/javascript">
		window.onload = function() {
			var vue = new Vue({
				el: '#qingjia-right',
				data: {
					roleList: [],
					cData: [],
					username:''
					
				},
				methods: {
					getRole() {
						axios.get('http://localhost:8080/kaoqin/role/findAll.do').then(
							function(backdatas) {
								var roledata = backdatas.data;
									vue.roleList = roledata.data;
								
							})
					},
					
					add(){
						var rs=this.username
						var datas={
							'name':rs,
						}
						var url='http://localhost:8080/attendance-service/wwx/post'
						axios.post(url,datas).then(function(backdatas){
							location.reload();
						})
					},
					
					deleterole(){
						var ids=vue.cData
						var datas={
							'ids':ids,
						}
						var url='http://localhost:8080/kaoqin/role/delete.do'
						axios.post(url,datas).then(function(backdatas){
							var flag=backdatas.data.code==200;
							console.log(flag);
							if(flag){
							location.reload();
							}else{ 
								var arry=backdatas.data;
								var s='';
								for (i = 0; i < arry.length; i++) {
								  var roleid=arry[i];
								  console.log(roleid);
								  s=s+roleid+'   ';
								}
								console.log(s+'无法删除');
							}
						})
					}
				},
			});
			vue.getRole();
		}
	</script>
</html>
